﻿using System;

namespace Validate.Net
{
    /// <summary>
    /// 校验必填项
    /// </summary>
    public class ValidateRequiredAttribute : AbstractValidateAttribute
    {
        public override bool Validate(object value, out string msg)
        {
            if (!string.IsNullOrWhiteSpace(value?.ToString()))
            {
                msg = string.Empty;
                return true;
            }
            else
            {
                msg = "校验必填项失败";
                return false;
            }
        }
    }
}
